\hypertarget{classMPC}{}\doxysection{M\+PC Class Reference}
\label{classMPC}\index{MPC@{MPC}}


This class implements the model predictive controller.  




{\ttfamily \#include $<$mpc.\+h$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classMPC_af4e2bb7c17925152b578a24b3d8f3791}{M\+PC}} (double dt\+In)
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classMPC}{M\+PC}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a41574ac96dfd97c389bb6f9c1de01c06}{set\+\_\+weight}} (double u\+\_\+weight, Eigen\+::\+Matrix\+Xd L\+\_\+diag, Eigen\+::\+Matrix\+Xd K\+\_\+diag)
\begin{DoxyCompactList}\small\item\em Set the weight of cost function. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a618d7e191ba58809e20dc03cc790dbe4}{cal}} ()
\begin{DoxyCompactList}\small\item\em run \mbox{\hyperlink{classMPC}{M\+PC}} \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a0e37e446706cbf8d8f6de14377423d9d}{data\+Bus\+Read}} (\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&Data)
\begin{DoxyCompactList}\small\item\em read data from data bus \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a81bff1debd03ea83a56c85da5a70caf9}{data\+Bus\+Write}} (\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&Data)
\begin{DoxyCompactList}\small\item\em write date to data bus \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a01dcc1140862fcb030153849a9cb3ff9}{enable}} ()
\begin{DoxyCompactList}\small\item\em enable \mbox{\hyperlink{classMPC}{M\+PC}} calculation \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classMPC_a39bcff9265cd0e14857c190cf42c418c}{disable}} ()
\begin{DoxyCompactList}\small\item\em disable \mbox{\hyperlink{classMPC}{M\+PC}} calculation \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classMPC_a23fc46fc8d12f89adad3c19035f93579}{get\+\_\+\+E\+NA}} ()
\begin{DoxyCompactList}\small\item\em get current \mbox{\hyperlink{classMPC}{M\+PC}} enable state \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This class implements the model predictive controller. 



Definition at line 36 of file mpc.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classMPC_af4e2bb7c17925152b578a24b3d8f3791}\label{classMPC_af4e2bb7c17925152b578a24b3d8f3791}} 
\index{MPC@{MPC}!MPC@{MPC}}
\index{MPC@{MPC}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{MPC()}{MPC()}}
{\footnotesize\ttfamily M\+P\+C\+::\+M\+PC (\begin{DoxyParamCaption}\item[{double}]{dt\+In }\end{DoxyParamCaption})}



Construct a new \mbox{\hyperlink{classMPC}{M\+PC}} object. 


\begin{DoxyParams}{Parameters}
{\em dt\+In} & \mbox{\hyperlink{classMPC}{M\+PC}} control frequency \\
\hline
\end{DoxyParams}


Definition at line 12 of file mpc.\+cpp.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classMPC_a618d7e191ba58809e20dc03cc790dbe4}\label{classMPC_a618d7e191ba58809e20dc03cc790dbe4}} 
\index{MPC@{MPC}!cal@{cal}}
\index{cal@{cal}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{cal()}{cal()}}
{\footnotesize\ttfamily void M\+P\+C\+::cal (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



run \mbox{\hyperlink{classMPC}{M\+PC}} 

calculte the desired ground reaction force and moment 

Definition at line 167 of file mpc.\+cpp.



References Data\+Bus\+::\+D\+St, and Data\+Bus\+::\+L\+St.

\mbox{\Hypertarget{classMPC_a0e37e446706cbf8d8f6de14377423d9d}\label{classMPC_a0e37e446706cbf8d8f6de14377423d9d}} 
\index{MPC@{MPC}!dataBusRead@{dataBusRead}}
\index{dataBusRead@{dataBusRead}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{dataBusRead()}{dataBusRead()}}
{\footnotesize\ttfamily void M\+P\+C\+::data\+Bus\+Read (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&}]{Data }\end{DoxyParamCaption})}



read data from data bus 


\begin{DoxyParams}{Parameters}
{\em Data} & \\
\hline
\end{DoxyParams}


Definition at line 88 of file mpc.\+cpp.



References Data\+Bus\+::base\+\_\+omega\+\_\+W, Data\+Bus\+::base\+\_\+pos, Data\+Bus\+::base\+\_\+rot, Data\+Bus\+::base\+\_\+rpy, Data\+Bus\+::dq, Data\+Bus\+::fe\+\_\+l\+\_\+pos\+\_\+W, Data\+Bus\+::fe\+\_\+l\+\_\+rot\+\_\+W, Data\+Bus\+::fe\+\_\+r\+\_\+pos\+\_\+W, Data\+Bus\+::fe\+\_\+r\+\_\+rot\+\_\+W, Data\+Bus\+::inertia, Data\+Bus\+::js\+\_\+eul\+\_\+des, Data\+Bus\+::js\+\_\+omega\+\_\+des, Data\+Bus\+::js\+\_\+pos\+\_\+des, Data\+Bus\+::js\+\_\+vel\+\_\+des, Data\+Bus\+::leg\+State, Data\+Bus\+::leg\+State\+Next, Data\+Bus\+::\+L\+St, Data\+Bus\+::phi, Data\+Bus\+::q, and Data\+Bus\+::slop.

\mbox{\Hypertarget{classMPC_a81bff1debd03ea83a56c85da5a70caf9}\label{classMPC_a81bff1debd03ea83a56c85da5a70caf9}} 
\index{MPC@{MPC}!dataBusWrite@{dataBusWrite}}
\index{dataBusWrite@{dataBusWrite}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{dataBusWrite()}{dataBusWrite()}}
{\footnotesize\ttfamily void M\+P\+C\+::data\+Bus\+Write (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structDataBus}{Data\+Bus}} \&}]{Data }\end{DoxyParamCaption})}



write date to data bus 


\begin{DoxyParams}{Parameters}
{\em Data} & \\
\hline
\end{DoxyParams}


Definition at line 453 of file mpc.\+cpp.



References Data\+Bus\+::base\+\_\+pos\+\_\+des, Data\+Bus\+::base\+\_\+rpy\+\_\+des, Data\+Bus\+::des\+\_\+ddq, Data\+Bus\+::des\+\_\+delta\+\_\+q, Data\+Bus\+::des\+\_\+dq, Data\+Bus\+::dq, Data\+Bus\+::d\+X\+\_\+cal, Data\+Bus\+::fe\+\_\+react\+\_\+tau\+\_\+cmd, Data\+Bus\+::\+Fr\+\_\+ff, Data\+Bus\+::js\+\_\+eul\+\_\+des, Data\+Bus\+::js\+\_\+omega\+\_\+des, Data\+Bus\+::js\+\_\+pos\+\_\+des, Data\+Bus\+::js\+\_\+vel\+\_\+des, Data\+Bus\+::qp\+\_\+cpu\+Time\+\_\+\+M\+PC, Data\+Bus\+::qp\+\_\+n\+W\+S\+R\+\_\+\+M\+PC, Data\+Bus\+::qp\+Status\+\_\+\+M\+PC, Data\+Bus\+::\+X\+\_\+cal, Data\+Bus\+::\+X\+\_\+cur, and Data\+Bus\+::\+Xd.

\mbox{\Hypertarget{classMPC_a39bcff9265cd0e14857c190cf42c418c}\label{classMPC_a39bcff9265cd0e14857c190cf42c418c}} 
\index{MPC@{MPC}!disable@{disable}}
\index{disable@{disable}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{disable()}{disable()}}
{\footnotesize\ttfamily void M\+P\+C\+::disable (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



disable \mbox{\hyperlink{classMPC}{M\+PC}} calculation 



Definition at line 485 of file mpc.\+cpp.

\mbox{\Hypertarget{classMPC_a01dcc1140862fcb030153849a9cb3ff9}\label{classMPC_a01dcc1140862fcb030153849a9cb3ff9}} 
\index{MPC@{MPC}!enable@{enable}}
\index{enable@{enable}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{enable()}{enable()}}
{\footnotesize\ttfamily void M\+P\+C\+::enable (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



enable \mbox{\hyperlink{classMPC}{M\+PC}} calculation 



Definition at line 482 of file mpc.\+cpp.

\mbox{\Hypertarget{classMPC_a23fc46fc8d12f89adad3c19035f93579}\label{classMPC_a23fc46fc8d12f89adad3c19035f93579}} 
\index{MPC@{MPC}!get\_ENA@{get\_ENA}}
\index{get\_ENA@{get\_ENA}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{get\_ENA()}{get\_ENA()}}
{\footnotesize\ttfamily bool M\+P\+C\+::get\+\_\+\+E\+NA (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



get current \mbox{\hyperlink{classMPC}{M\+PC}} enable state 

\begin{DoxyReturn}{Returns}
true \+: \mbox{\hyperlink{classMPC}{M\+PC}} enable 

false \+: \mbox{\hyperlink{classMPC}{M\+PC}} disable 
\end{DoxyReturn}


Definition at line 489 of file mpc.\+cpp.

\mbox{\Hypertarget{classMPC_a41574ac96dfd97c389bb6f9c1de01c06}\label{classMPC_a41574ac96dfd97c389bb6f9c1de01c06}} 
\index{MPC@{MPC}!set\_weight@{set\_weight}}
\index{set\_weight@{set\_weight}!MPC@{MPC}}
\doxysubsubsection{\texorpdfstring{set\_weight()}{set\_weight()}}
{\footnotesize\ttfamily void M\+P\+C\+::set\+\_\+weight (\begin{DoxyParamCaption}\item[{double}]{u\+\_\+weight,  }\item[{Eigen\+::\+Matrix\+Xd}]{L\+\_\+diag,  }\item[{Eigen\+::\+Matrix\+Xd}]{K\+\_\+diag }\end{DoxyParamCaption})}



Set the weight of cost function. 


\begin{DoxyParams}{Parameters}
{\em u\+\_\+weight} & i.\+e. alpha, alpha $\ast$ K is the weighted matrix of control input in cost fuction \\
\hline
{\em L\+\_\+diag} & the diagonal of weighted matrix of state variable in cost function, should be row vector \\
\hline
{\em K\+\_\+diag} & the diagonal of weighted matrix of control input in cost function, should be row vector \\
\hline
\end{DoxyParams}


Definition at line 74 of file mpc.\+cpp.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
mpc.\+h\item 
mpc.\+cpp\end{DoxyCompactItemize}
